<template>
  <view style="width:100%;height:300px;">
    <qiun-data-charts
      type="line"
      :chartData="chartData"
      :opts="opts"
      :canvas2d="true"
      :animation="true"
    />
  </view>
</template>
<script>
import QiunDataCharts from '@/uni_modules/qiun-data-charts/components/qiun-data-charts/qiun-data-charts.vue'
export default {
  components: { QiunDataCharts },
  props: ['refreshKey'],
  data() {
    return {
      chartData: { categories: [], series: [] },
      opts: {}
    }
  },
  watch: {
    refreshKey() { this.genData() }
  },
  mounted() { this.genData() },
  methods: {
    genData() {
      this.chartData = {
        categories: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
        series: [
          { name: '主阀门', data: [80, 82, 78, 90, 85, 88, 92] },
          { name: '分支阀门', data: [60, 65, 70, 68, 72, 75, 78] }
        ]
      }
    }
  }
}
</script> 